<!--conf
<sample>
               <product version="1.4" edition="std"/>
                       <modifications>
                               <modified date="070101"/>
                       </modifications>
               </sample>
 --> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Change Grid's parent object</title>
	
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
<body>
	<h1>Change Grid's parent object</h1>
	<p>You can use attachToObject method to move grid from one place to another switching its parent items.</p>
	<table width="600px">
		<tr>
			<td id="parent1" style="border:1px solid red">&nbsp;
				<div id="gridbox" style="width:500px; height:150px; background-color:white;overflow:hidden"></div>
			</td>
			<td><input type="button" onClick="moveTo('parent1')" value="&lt; Move Here" /></td>
		</tr>
		<tr>
			<td id="parent2" style="border:1px solid blue">&nbsp;</td>
			<td><input type="button" onClick="moveTo('parent2')" value="&lt; Move Here" /></td>
		</tr>
		<tr>
			<td id="parent3" style="border:1px solid green">&nbsp;</td>
			<td><input type="button" onClick="moveTo('parent3')" value="&lt; Move Here" /></td>
		</tr>
	</table>

		<strong>Parameters passed to the constructor are:</strong>
			<ul>
				<li>object to attach grid to (should be loaded before calling constructor)</li>
			</ul>
<script>
	//switch parent to new one
	function moveTo(objId){
		mygrid.attachToObject(document.getElementById(objId))	
	}
		
	mygrid = new dhtmlXGridObject('gridbox');
	mygrid.setImagePath("../../../codebase/imgs/");
	mygrid.setHeader("Sales,Book Title");
	mygrid.setInitWidths("100,*")
	mygrid.setColAlign("right,left")
	mygrid.setColTypes("dyn,ed");
	mygrid.setColSorting("int,str")
	mygrid.enableMultiselect(true)
	mygrid.init();
	mygrid.setSkin("dhx_skyblue")
	mygrid.loadXML("../common/grid.xml");
</script>

</body>
</html>
